home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / Chip_2004-11_cd1.bin / zkuste / planetaria / download / celestia / celestia-win32-1.3.2.exe / {app} / shaders / eclipse2_nv.fp < prev    next >
Text File  |  2004-03-04  |  750b  |  35 lines

  1. !!FP1.0
  2.  
  3. # Eclipse shadow shader--this shader computes a black circle centered
  4. # at texcoord (0.5, 0.5) and multiplies this by texture zero and the
  5. # diffuse color.
  6.  
  7. # Parameters:
  8. # p[5]  - ambient light color
  9. # p[20] - shadow umbra/penumbra parameters (x = scale, y = bias)
  10. # p[21] - shadow umbra/penumbra parameters (x = scale, y = bias)
  11.  
  12. SUB R0, f[TEX0], { 0.5, 0.5, 0, 0 };
  13. DP3 R1.x, R0, R0;
  14. MAD_SAT R1.x, R1.x, p[20].x, p[20].y;
  15. #POW R1.x, R1.x, 0.5;
  16. RSQ R1.x, R1.x;
  17. RCP R1.x, R1.x;
  18.  
  19. SUB R0, f[TEX1], { 0.5, 0.5, 0, 0 };
  20. DP3 R1.y, R0, R0;
  21. MAD_SAT R1.y, R1.y, p[21].x, p[21].y;
  22. #POW R1.y, R1.y, 0.5;
  23. RSQ R1.y, R1.y;
  24. RCP R1.y, R1.y;
  25.  
  26. MINX R0.xyz, R1.x, R1.y;
  27.  
  28. # Add the ambient light
  29. ADDX_SAT R0.xyz, R0, p[5];
  30.  
  31. # Output it
  32. MOVX o[COLR], R0;
  33.  
  34. END
  35.